/*
 * splitter.h
 *
 *  Created on: Feb 4, 2012
 *      Author: jiabin
 */

#ifndef SPLITTER_H_
#define SPLITTER_H_

enum bool {FALSE, TRUE};

/* maximum size of incoming message */
#define MAX_READ 255

/* maximum size of outgoing message */
#define MAX_WRITE 255

/* connection structure.
   one is maintained per connection with an agent
   (see global array variable agent_connections)
   and per connection with a client
   (see global array variable client_connections) */
struct connection {
  int sockfd;            /* socket desciptor */
  enum bool connected;   /* connected state (FALSE or TRUE) */
  struct buffer *buffer; /* outgoing message buffer */
  struct agent *agent;   /* pointer to agent structure (see config.h)
                            (unused for client connections */
  unsigned char *secret; /* secret shared between two ends */
  unsigned int seq;      /* sequence number */
  unsigned char *iv;     /* negotiated init vector */
  struct connection *next;
};

#endif /* SPLITTER_H_ */
